package com.etone.smartAudit.controller;


import com.etone.smartAudit.annotation.LoginAdmin;
import com.etone.smartAudit.domain.Admin;
import com.etone.smartAudit.dto.certificate.CertificateReplyDTO;
import com.etone.smartAudit.mapper.AdminMapper;
import com.etone.smartAudit.security.SecurityUtils;
import com.etone.smartAudit.security.jwt.JWTConfigurer;
import com.etone.smartAudit.service.CertificateReplyService;
import com.etone.smartAudit.vo.certificate.CertificateReplyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 回复意见  前端控制器
 * </p>
 *
 * @author jiayen
 * @since 2021-06-23
 */
@RestController
@Api(value = "回复意见", tags = "回复意见")
public class CertificateReplyController {

    @Autowired
    private CertificateReplyService replyService;

    @ApiModelProperty(value = "发布回复意见")
    @PostMapping("/certificateFile/noAuth/reply")
    public void replyContent(HttpServletRequest request, @RequestBody CertificateReplyDTO dto) {
//        String loginToken = request.getHeader(JWTConfigurer.AUTHORIZATION_HEADER);
        replyService.addReply( dto);
    }

    /***
     * 获取回复列表
     * @return
     */
    @ApiModelProperty(value = "获取回复列表")
    @GetMapping("/certificateFile/noAuth/replys")
    public List<CertificateReplyVO> getReplyList(@ApiParam("执行人id") @RequestParam Integer handId) {

        return replyService.getReplyList(handId);
    }
}
